if(Boost_INCLUDE_DIRS)
    set(INCLUDES ${Boost_INCLUDE_DIRS})
    set(LIBS ${Boost_LIBRARIES})
else(Boost_INCLUDE_DIRS)
    set(LIBS Boost::boost)
endif(Boost_INCLUDE_DIRS)
include_directories(
    ${PROJECT_SOURCE_DIR}
    ${INCLUDES}
    )
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
    set(COMPILE_DEFINITIONS DEBUG_GDSREADER DEBUG_GDSWRITER)
else()
    set(COMPILE_DEFINITIONS "")
endif()

add_executable(test_gdsii_reader test_reader.cpp)
set_target_properties(test_gdsii_reader PROPERTIES OUTPUT_NAME "test_reader")
target_link_libraries(test_gdsii_reader PRIVATE gdsparser gzstream ${LIBS} ${ZLIB_LIBRARIES})
if(COMPILE_DEFINITIONS)
    target_compile_definitions(test_gdsii_reader PRIVATE ${COMPILE_DEFINITIONS})
endif(COMPILE_DEFINITIONS)
if(INSTALL_LIMBO)
    install(TARGETS test_gdsii_reader DESTINATION test/parsers/gdsii)
endif(INSTALL_LIMBO)

add_executable(test_gdsii_writer test_writer.cpp)
set_target_properties(test_gdsii_writer PROPERTIES OUTPUT_NAME "test_writer")
target_link_libraries(test_gdsii_writer PRIVATE gdsparser gzstream ${LIBS} ${ZLIB_LIBRARIES})
if(COMPILE_DEFINITIONS)
    target_compile_definitions(test_gdsii_writer PRIVATE ${COMPILE_DEFINITIONS})
endif(COMPILE_DEFINITIONS)
if(INSTALL_LIMBO)
    install(TARGETS test_gdsii_writer DESTINATION test/parsers/gdsii)
endif(INSTALL_LIMBO)

add_executable(test_gdsii_driver test_driver.cpp)
set_target_properties(test_gdsii_driver PROPERTIES OUTPUT_NAME "test_driver")
target_link_libraries(test_gdsii_driver PRIVATE gdsparser gzstream ${LIBS} ${ZLIB_LIBRARIES})
if(COMPILE_DEFINITIONS)
    target_compile_definitions(test_gdsii_driver PRIVATE ${COMPILE_DEFINITIONS})
endif(COMPILE_DEFINITIONS)
if(INSTALL_LIMBO)
    install(TARGETS test_gdsii_driver DESTINATION test/parsers/gdsii)
endif(INSTALL_LIMBO)

add_executable(test_gdsii_gdsdb test_gdsdb.cpp)
set_target_properties(test_gdsii_gdsdb PROPERTIES OUTPUT_NAME "test_gdsdb")
target_link_libraries(test_gdsii_gdsdb PRIVATE gdsdb gdsparser gzstream ${LIBS} ${ZLIB_LIBRARIES})
if(COMPILE_DEFINITIONS)
    target_compile_definitions(test_gdsii_gdsdb PRIVATE ${COMPILE_DEFINITIONS})
endif(COMPILE_DEFINITIONS)
if(INSTALL_LIMBO)
    install(TARGETS test_gdsii_gdsdb DESTINATION test/parsers/gdsii)
    install(DIRECTORY benchmarks DESTINATION test/parsers/gdsii)
endif(INSTALL_LIMBO)
